const Router = require('@koa/router');
const router = new Router({
  prefix: '/abc'
});
router
  .get('/total', async (ctx, next) => {
    ctx.body = `文章总数`
    const url = ctx.router.url('typeName', { id: 10 }, { query: { limit: 1 } })
    console.log('url', url);
    ctx.redirect(url);
  })
  .get('/info/:id', async (ctx, next) => {
    ctx.body = `文章信息：${ctx.params.id}`
  })
  .post('/add', async (ctx, next) => {
    ctx.body = '新增文章'
  })
  .post('/list', async (ctx, next) => {
    console.log(11111);
    ctx.body = '文章列表'
    ctx.redirect('/articles/abc/total')
  })
  .get('typeName', '/type/:id', async (ctx, next) => {
    ctx.body = `文章类别，${ctx.params.id}`
  })



module.exports = router
